package cn.iocoder.yudao.module.member.service.userrefund;

import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class RefundStrategy {

    @Resource(name = "step1RefundService")
    private IRefundService step1RefundService;
    @Resource(name = "step2RefundService")
    private IRefundService step2RefundService;
    @Resource(name = "step3RefundService")
    private IRefundService step3RefundService;
    @Resource(name = "step4RefundService")
    private IRefundService step4RefundService;
    @Resource(name = "step5RefundService")
    private IRefundService step5RefundService;

    public IRefundService getRefundService(Integer useTotalPoints) {
        if (useTotalPoints < step2RefundService.getBasePoints()) {
            return step1RefundService;
        } else if (useTotalPoints < step3RefundService.getBasePoints()) {
            return step2RefundService;
        } else if (useTotalPoints < step4RefundService.getBasePoints()) {
            return step3RefundService;
        } else if (useTotalPoints < step5RefundService.getBasePoints()) {
            return step4RefundService;
        } else {
            return step5RefundService;
        }
    }

    public Integer getUseFee(Integer useTotalPoints) {
        return getRefundService(useTotalPoints).getUseFee(useTotalPoints);
    }

}
